package com.roocon.design_pattern.chapter08_active_object;

public class ActiveTaskProxy implements ActiveTask {

  private final WorkingPlan plan;
  private final Worker worker;

  public ActiveTaskProxy(WorkingPlan plan,
      Worker worker) {
    this.plan = plan;
    this.worker = worker;
  }

  @Override public Result doWorkForResult(int count, char fillChar) {
    FutureResult futureResult = new FutureResult();
    plan.plan(new BuildHouseTask(worker, futureResult, count, fillChar));
    return futureResult;
  }

  @Override public void doWork(String content) {
    plan.plan(new DisplayTask(worker, content));
  }
}
